|
|
@@ -83,7 +83,7 @@ module Agents
|
83
|
83
|
payload = { 'url' => url, 'response_received' => false, 'elapsed_time' => total_time }
|
84
|
84
|
|
85
|
85
|
# Deal with failures
|
86
|
|
- if measured_result
|
|
86
|
+ if measured_result.status != 0
|
87
|
87
|
final_url = boolify(options['disable_redirect_follow']) ? url : measured_result.to_hash[:url]
|
88
|
88
|
payload.merge!({ 'final_url' => final_url, 'redirected' => (url != final_url), 'response_received' => true, 'status' => current_status })
|
89
|
89
|
# Deal with headers
|
|
|
@@ -104,9 +104,7 @@ module Agents
|
104
|
104
|
|
105
|
105
|
def ping(url)
|
106
|
106
|
result = faraday.get url
|
107
|
|
- if result.status != 0
|
108
|
|
- return result
|
109
|
|
- end
|
|
107
|
+ result.status != 0 ? result : nil
|
110
|
108
|
rescue
|
111
|
109
|
nil
|
112
|
110
|
end
|